<?php 
//更新统计方案分类缓存
$arrTypess = $db->fetch_all_assoc("select * from ".dbprefix."plan_type");
foreach($arrTypess as $key=>$item){
	$plan = $db->once_fetch_assoc("select count(planid) from ".dbprefix."plan where typeid='".$item['typeid']."'");
	$arrTypes['list'][] = array(
		'typeid'	=> $item['typeid'],
		'typename'	=> $item['typename'],
		'count_plan'	=> $plan['count(planid)'],
	);
}

$planNum = $db->once_fetch_assoc("select count(planid) from ".dbprefix."plan");
$arrTypes['count'] = $planNum['count(planid)'];

//生成缓存文件
fileWrite('plan_types.php','data',$arrTypes);

qiMsg("更新成功！");